<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>售后日志修改-</title>
<link rel="stylesheet" type="text/css" href="css/css.css" />
<style>
	#emptable td{
		font-size: 16px;
		border:none !important;
	}
	.bbD .td{
		font-size: 16px;
		text-aign:right;
	}
	.btext2 .text2{
		min-width:292px;
		max-width:292px;
	}
	.button{
			font-size: 16px;
			margin-top:20px;
			margin-left:150px;
			width: 135px;
			height: 40px;
			border-radius:20px;
			border: 1px solid #ccc;
			color: #fff;
			background-color: #47a4e1
	}
</style>
<script type="text/javascript" src="js/jquery.min.js"></script>
</head>
<body>
	<div id="pageAll">
		<div class="pageTop">
			<div class="page">
				<img src="img/coin02.png" /><span><a href="main.do">首页</a>&nbsp;-&nbsp;
				<a href="aftersaleinfo.do">售后管理</a>&nbsp;-</span>&nbsp;售后日志编辑
			</div>
		</div>
		<div class="page ">
			<!-- 上传广告页面样式 -->
			<div class="banneradd bor">
				<form action="aftersaleupdate.do" method="post">
					<div class="baTopNo">
						<span>基本信息</span>
						<hr/>
					</div>
					<div class="baBody" >
						<table id="aftersaletable">	
							<tr class="bbD">
								<td class="td">售后标题：</td>
								<td>
									<input type="text" class="input3" name="title" id="title" onblur="checkTitle()" value="${sessionScope.aftersale.title }"/>
									<input type="hidden" class="input3" name="id" value="${sessionScope.aftersale.id }"/>
								</td>
								<td><span id="titleinfo"></span></td>
							</tr>
						
							<tr class="bbD" >
								<td class="td">机构：</td>
								<td>
									<select class="input3" name="oid" id="organization" onblur="checkOrganization()">
										<option value="${sessionScope.aftersale.organization.id }">${sessionScope.aftersale.organization.name}</option>
										<c:forEach items="${sessionScope.organizations }" var="organization">
											<option value="${organization.id}">${organization.name }</option>
										</c:forEach>
									</select>
								</td>				
								<td><span id="organizationinfo"></span></td>
							</tr>
							<tr class="bbD">
								<td class="td">售后类型：</td>
								<td>
									<select class="input3" id="type" name="type">
									 	<option value="1" <c:if test="${sessionScope.aftersale.type==1 }">selected="selected"</c:if>>售后处理</option>
										<option value="2" <c:if test="${sessionScope.aftersale.type==2 }">selected="selected"</c:if>>培训推广</option>
										<option value="3" <c:if test="${sessionScope.aftersale.type==3 }">selected="selected"</c:if>>其他</option>
									</select>
								</td>
							</tr>
							<tr class="bbD">
								<td class="td">售后内容：</td>
								<td>
									<input type="text" class="input3" name="content" id="content" onblur="checkContent()" value="${sessionScope.aftersale.content }"/>
									<input type="hidden" class="input3" name="id" value="${sessionScope.aftersale.id }"/>
								</td>
								<td><span id="contentinfo"></span></td>
							</tr>
							<tr class="bbD">
								<td class="td">重要级别：</td>
								<td>
									<select class="input3" id="importantlevel" name="importantlevel">
									 	<option value="1" <c:if test="${sessionScope.aftersale.importantlevel==1 }">selected="selected"</c:if>>一般</option>
										<option value="2" <c:if test="${sessionScope.aftersale.importantlevel==2 }">selected="selected"</c:if>>重要</option>
										<option value="3" <c:if test="${sessionScope.aftersale.importantlevel==3 }">selected="selected"</c:if>>非常重要</option>
									</select>
								</td>
							</tr>
							<tr class="bbD">
								<td class="td">处理状态：</td>
								<td>
									<select class="input3" id="dealstate" name="dealstate">
									 	<option value="1" <c:if test="${sessionScope.aftersale.dealstate==1 }">selected="selected"</c:if>>未处理</option>
										<option value="2" <c:if test="${sessionScope.aftersale.dealstate==2 }">selected="selected"</c:if>>处理中</option>
										<option value="3" <c:if test="${sessionScope.aftersale.dealstate==3 }">selected="selected"</c:if>>已处理</option>
									</select>
								</td>
							</tr>
							<tr class="bbD" >
								<td class="td">部门：</td>
								<td>
									<select class="input3" name="did" id="dept" onblur="checkDept()">
										<option value="${sessionScope.aftersale.dept.id }">${sessionScope.aftersale.dept.name}</option>
										<c:forEach items="${sessionScope.depts }" var="dept">
											<option value="${dept.id}">${dept.name }</option>
										</c:forEach>
									</select>
								</td>				
								<td><span id="deptinfo"></span></td>
							</tr>
							
							<tr class="bbD">
								<td class="td">处理人：</td>
								<td>
									<input type="text" class="input3" name="transactor" id="transactor" onblur="checkTransactor()" value="${sessionScope.aftersale.transactor }"/>
									<input type="hidden" class="input3" name="id" value="${sessionScope.aftersale.id }"/>
								</td>
								<td><span id="transactorinfo"></span></td>
							</tr>
						</table>
							<input class="button" type="submit" value="编辑" />							
					</div>
				</form>		
			</div>

			<!-- 上传广告页面样式end -->
		</div>
	</div>
	<!-- js非空验证 -->
	<script type="text/javascript">
	
		function checkDept(){
			$("#deptinfo").html("");
			var dept=$("#dept").val();
			if(dept==null || ""==dept){
				$("#deptinfo").html("部门不可以为空").css({color:"red"});
				return false;
			}
			return true;
		}
		
		function checkOrganization() {
			$("#organizationinfo").html("");
			var organization = $("#organization").val();
			if (organization == null || "" == organization) {
				$("#organization").html("机构不可以为空").css({
					color : "red"
				});
				return false;
			}
			return true;
		}
		
		function checkTransactor() {
			$("#transactorinfo").html("");
			var reg = /[^\x00-\x80]/;
			var transactor = $("#transactor").val();
			if (transactor == null || "" == transactor) {
				$("#transactorinfo").html("姓名不可以为空").css({
					color : "red"
				});
				return false;
			} else if (!reg.test(transactor)) {
				$("#transactorinfo").html("姓名必须是汉字").css({
					color : "red"
				});
				return false;
			}
			return true;
		}



	

		function isExsit(){
			if(checkDept() && checkAftersalename()  && checkTransactor()){
				return true;
			}else{
				return false;
			}
		}
		
		
	</script>
</body>
</html>